package com.biz.primus.management.promotion.controller;

import com.biz.primus.common.utils.JsonUtils;
import com.biz.primus.management.base.controller.AbstractBaseController;
import com.biz.primus.management.promotion.service.PromotionSupportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * 下单有礼后台Controller
 *
 * @author david-liu
 */
@Controller
@RequestMapping(value = "/management/luckyOrderPromotion")
public class LuckyOrderPromotionController extends AbstractBaseController {

    @Autowired
    private PromotionSupportService promotionSupportService;

    @RequestMapping(value = "new")
    public ModelAndView create() {
        return new ModelAndView("lucky_order/add");
    }

    @RequestMapping(value = "coupons")
    @ResponseBody
    public String coupons(Long id) {
        return JsonUtils.obj2Json(promotionSupportService.listGiftCouponsInLuckyOrderPromotion(id));
    }

}
